<%@page import="java.util.ArrayList"%>
<%@page import="cn.edu.thsis.pojo.thsis"%>
<%@page import="java.util.List"%>
<%@page import="cn.edu.thsis.pojo.User"%>
<%@page import="java.sql.ResultSet"%>
<%@page import="java.sql.PreparedStatement"%>
<%@page import="cn.edu.thsis.dao.impl.jdbcUtils"%>
<%@page import="java.sql.Connection"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewpoit" content="width=device-width,initial-scale=1">
    <meta name="renderer" content="webkit">
    <title>毕业论文选题系统-论文列表</title>
    <link rel="stylesheet" href="${pageContext.request.contextPath}/css/bootstrap.min.css">
    <link rel="stylesheet" href="${pageContext.request.contextPath}/css/font-awesome.css">
    <link rel="stylesheet" href="${pageContext.request.contextPath}/css/animate.css">
    <link rel="stylesheet" href="${pageContext.request.contextPath}/css/style.css">
    <link rel="stylesheet" href="${pageContext.request.contextPath}/css/plugins/footable/footable.core.css">
</head>
<body class="gray-bg">
<div class="wrapper wrapper-content animated fadeInRight">
    <div class="row">
        <div class="col-sm-12">
            <div class="ibox float-e-margins">
                <div class="ibox-title">
                    <h5>毕业论文题目列表</h5>
                </div>
                <div class="ibox-content">
                    <table class="footable table table-stripped toggle-arrow-tiny" data-page-size="20">
                        <thead>
                        <tr>
                            <td>论题名称</td>
                            <td>教师</td>
                            <td>论题状态</td>
                            <td>操作</td>
                            <td>其他</td>
                            <th data-hide="all">论题类型</th>
                            <th data-hide="all">教师职称</th>
                            <th data-hide="all">题目性质</th>
                            <th data-hide="all">老师联系方式</th>
                        </tr>
                        </thead>
                        <tbody>
                        <%
                        User user = (User)request.getSession().getAttribute("user");
                        String sql = "SELECT th.thsis_id,th.thsis_name,thsis_class,th.thsis_kind,t.uname,t.tea_title,t.tea_tel,t.uid,th.`select` FROM thsis th,teacher t WHERE th.tea_id=t.uid";
                        Connection conn = jdbcUtils.getConnection();
                        PreparedStatement ps = conn.prepareStatement(sql);
                        ResultSet rs = ps.executeQuery();
                        while(rs.next()){
                        %>
                        <tr>
                            <td><%=rs.getString("thsis_name")%></td>
                            <td><%=rs.getString("uname")%></td>
                            <%
	                            Integer select = rs.getInt("select");
                                	if(select.equals(2)){
                            %>
                            <td>已锁定</td>
                            <td><a href=""><input type="button" class="btn btn-default btn-xs" disabled="disabled" value="预约选择"></a></td>
                            <td><button type="button" class="btn btn-white btn-xs" disabled="disabled">留言</button></td>
                            <%}
                                	else if(select.equals(1)){
                            %>
                                <td>可预约选择</td>
                                <td><a href="${pageContext.request.contextPath}/StuSvlt?oper=enrol&stu_id=<%=user.getUid()%>&thsis_id=<%=rs.getString("thsis_id")%>"><input type="button" class="btn btn-primary btn-xs" value="预约选择"></a></td>
                                <td><a href="${pageContext.request.contextPath}/student/stu_talk.jsp"><button type="button" class="btn btn-white btn-xs">留言</button></a></td>
                                <%} %>
                            <td><%=rs.getString("thsis_class")%></td>
                            <td><%=rs.getString("tea_title")%></td>
                            <td><%=rs.getString("thsis_kind")%></td>
                            <td><%=rs.getString("tea_tel")%></td>
                            <%}%>
                        </tr>
                        </tbody>
                        </tbody>
                        <tfoot>
                        <tr>
                            <td colspan="5">
                                <ul class="pagination pull-right"></ul>
                            </td>
                        </tr>
                        </tfoot>
                    </table>
                </div>
            </div>
        </div>
    </div>
</div>
<!-- 全局js -->
<script src="${pageContext.request.contextPath}/js/jquery.min.js"></script>
<script src="${pageContext.request.contextPath}/js/bootstrap.min.js"></script>
<script src="${pageContext.request.contextPath}/js/plugins/footable/footable.all.min.js"></script>

<!-- 自定义js -->
<script src="${pageContext.request.contextPath}/js/content.js"></script>
<!-- Bootstrap table -->
<script src="${pageContext.request.contextPath}/js/plugins/bootstrap-table/bootstrap-table.min.js"></script>
<script src="${pageContext.request.contextPath}/js/plugins/bootstrap-table/bootstrap-table-mobile.min.js"></script>
<script src="${pageContext.request.contextPath}/js/plugins/bootstrap-table/locale/bootstrap-table-zh-CN.min.js"></script>

<!-- Peity -->
<script src="${pageContext.request.contextPath}/js/demo/bootstrap-table-demo.js"></script>
<script>
    $(document).ready(function() {

        $('.footable').footable();
        $('.footable2').footable();

    });
</script>
</body>
</html>